﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Xml;
using System.IO;

namespace PointOfSale
{
    public partial class Form1 : Form
    {
        Service1.Service1SoapClient serv;
        public Form1()
        {
            InitializeComponent();
            serv = new Service1.Service1SoapClient();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string xml = serv.DatabaseToXML(empresas.SelectedValue.ToString());
            String logo = serv.Obtener_Info_Empresa(empresas.SelectedValue.ToString()).Split(';')[2];
            DataSet n = new DataSet();
            n.ReadXml(new XmlTextReader(new StringReader(xml)));

            Form2 f = new Form2();
            f.datos = n;
            f.loadDatos();
            f.Show();
            f.setEmpresa(empresas.SelectedValue.ToString(), logo);
            this.Hide();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            List<string> Empresas = serv.Consultar(1).ToList();
            empresas.DataSource = Empresas;
        }

    }
}
